<template>
  <div ww3 auto>
    <el-page-header @back="goBack" content="发票中心"> </el-page-header>

    <el-tag type="warning" style="width: 100%; margin-bottom: 20px"
      >当前仅支持支持增值税（电子）普通发票开具，且已开票订单不能重复开票</el-tag
    >

    <el-card class="box-card">
      <dl flex flex-c space-be>
        <dt>
          <p fz-14>
            <!--            <span>已成功开票 <i>0</i> 个</span>
            <span>总计开票金额（元）<i>0</i></span>-->

            <span>可开发票充值订单<i>1</i>个</span>
            <span>总金额<i>1</i>元</span>
          </p>
        </dt>
        <!--        <el-tag type="warning">标签四</el-tag>-->
        <!--          <dd cur @click="applyVat" fz-14>申请开票</dd>-->

        <dd cur @click="vatlist" fz-14>全部开票</dd>
      </dl>
      <el-divider></el-divider>

      <el-table
        ref="multipleTable"
        :data="list"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column prop="orderNumber" label="订单编号"></el-table-column>
        <el-table-column prop="total" label="充值金额(元)">  </el-table-column>
        <el-table-column prop="address" label="剩余可开票金额">
          1元
        </el-table-column>

        <el-table-column prop="name" label="付款方式"> 
          <template slot-scope="scope">
            {{scope.row.payType == 2 ? '微信' : '支付宝'}}
          </template>
        </el-table-column>

        <el-table-column prop="payTime" label="付款支付时间方式">
        </el-table-column>
      </el-table>
    </el-card>

    <dl class="next-btn" ww1 flex flex-c fz-14>
      <dt red>申请发票金额（含税）1元</dt>
      <el-button
        type="primary"
        :disabled="disabled"
        style="padding: 1% 2%"
        @click="vatlist"
      >
        下一步
      </el-button>
    </dl>
  </div>
</template>

<script>
import $http from "@/api/info/info"
export default {
  name: "VatInvoice",

  data() {
    return {
      pageSize: 10,
      pageNum: 1,
      total: 10,
      list: [],
      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
      multipleSelection: [],
      disabled: true,
    };
  },

  mounted() {
    this.rechargeRecordLis();
  },

  methods: {
    /**
     * 获取开票数据
     */
    rechargeRecordLis() {
      let page = {
        pageSize: this.pageSize,
        pageNum: this.pageNum
      }
      let data = {
        userId: sessionStorage.getItem("userId"),
        isInvoice: ''
      }
      $http.rechargeRecordLis(page, data).then(res => {
        this.total = res.total;
        this.list = res.rows;
      })
    },
    goBack() {
      this.$router.go(-1);
    },

    //开票
    applyVat() {},

    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      console.log(val);
      if (val.length) {
        this.disabled = false;
      }
      this.multipleSelection = val;
    },
    vatlist() {
      this.$router.push({
        name: "vatList",
        params: {
          id: 900000,
        },
      });
    },
  },
};
</script>

<style scoped>
.box-card {
  min-height: 50vh;
  max-height: 50px;
}
.top-vat {
  color: var(--color-black);
  margin-bottom: 2%;
}
.top-vat span,
.box-card span {
  margin-right: 20px;
}
.box-card {
}
.box-card span {
  color: var(--grey);
}
.box-card span i {
  color: var(--nav-hover-red);
}
dd {
  color: var(--green);
}
.next-btn {
  padding: 20px;
  justify-content: flex-end;
}
.next-btn dt {
  margin-right: 10px;
}
</style>
